IF(NOT LMMS_SUPPORT_VST)
	RETURN()
ENDIF()

INCLUDE(BuildPlugin)
INCLUDE(ExternalProject)

# These variables are not meant to be used normally, except packaging
SET(REMOTE_VST_PLUGIN_FILEPATH_32 "32/RemoteVstPlugin32" CACHE STRING "Relative file path to RemoteVstPlugin32")
SET(REMOTE_VST_PLUGIN_FILEPATH_64 "RemoteVstPlugin64" CACHE STRING "Relative file path to RemoteVstPlugin64")

ADD_SUBDIRECTORY(vstbase)

SET(LMMS_BINARY_DIR ${CMAKE_BINARY_DIR})
SET(LMMS_SOURCE_DIR ${CMAKE_SOURCE_DIR})

SET(EXTERNALPROJECT_ARGS
	SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin"
	INSTALL_COMMAND ""
	BUILD_ALWAYS ON
)

SET(EXTERNALPROJECT_CMAKE_ARGS
	"-DLMMS_SOURCE_DIR=${CMAKE_SOURCE_DIR}"
	"-DLMMS_BINARY_DIR=${CMAKE_BINARY_DIR}"
	"-DCMAKE_RUNTIME_OUTPUT_DIRECTORY=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
	"-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}"
	"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
)

# build 32 bit version of RemoteVstPlugin
IF(WANT_VST_32)
	INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin32.cmake")
ENDIF()
# build 64 bit version of RemoteVstPlugin
IF(WANT_VST_64)
	INCLUDE("${CMAKE_CURRENT_LIST_DIR}/RemoteVstPlugin64.cmake")
ENDIF()
